package com.cnplan.controller;

import com.cnplan.core.KUtil;
import com.cnplan.service.ArcFileService;
import com.cnplan.service.ArcMainService;
import com.cnplan.service.ArcRollService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/arc_file")
public class ArcFileController {

    @Autowired
    private ArcFileService arcFileService;
    @Autowired
    private  KUtil kUtil;
    @Autowired
    private ArcMainService arcMainService;
    @Autowired
    private ArcRollService arcRollService;
    
    @GetMapping("/findpage")
    @ResponseBody
    public Object findPage(@RequestParam Map map,Model model){
        return "";
    }

    @GetMapping("/index")
    public String archives(@RequestParam Map map, Model model){
        model.addAttribute("mapData",map);
        return "archives/arcindex";
    }

    @GetMapping("/fileIndex")
    public String fileIndex(@RequestParam Map map, Model model){
        PageInfo pageInfo=arcFileService.findArcFile(map);
//        PageInfo pageInfo=arcRollService.findByArcRollData(map);
        model.addAttribute("pageInfo",pageInfo);
        model.addAttribute("mapData",map);
        return "archives/fileIndex";
    }

    @GetMapping("/list")
    public String archivesList(@RequestParam Map map, Model model){
//        model.addAttribute("dhData",map1);
//        ArcMain arcMain=arcMainService.findByArcNum(map.get("arcNum").toString());
//        PageInfo pageInfo=arcFileService.findArcFile(map);
//        model.addAttribute("pageInfo",pageInfo);
//        model.addAttribute("arcMain",arcMain);
        return "fileIndex";
    }

}
